package model;

import java.util.ArrayList;
import java.util.List;

public class Day {
	
	private String description;
	private List<Training> trainings;
	private List<Food> foods;
	private List<Integer> quantities;
	
	public Day(String d) {
		description = d;
		trainings = new ArrayList<Training>();
		foods = new ArrayList<Food>();
		quantities = new ArrayList<Integer>();
	}
	
	public List<Integer> getQuantities() {
		return quantities;
	}

	public String getDescription() {
		return description;
	}

	public List<Training> getTrainings() {
		return trainings;
	}

	public List<Food> getFoods() {
		return foods;
	}
	
	public void addFood(Food food, int quantity) {
		foods.add(food);
		quantities.add(new Integer(quantity));
	}
	
	public void addTraining(Training training) {
		trainings.add(training);
	}
	
	public int getCalories() {
		return getCaloriesEaten() + getCaloriesTrainings();
	}
	
	public int getCaloriesEaten() {
		int calEaten = 0;
		for (int i = 0; i < foods.size(); i++) {
			calEaten += foods.get(i).getCalories(quantities.get(i).intValue());
		}
		return calEaten;
	}
	
	public int getCaloriesTrainings() {
		int calTrainings = 0;
		for (int i = 0; i < trainings.size(); i++) {
			calTrainings += trainings.get(i).getCalories();
		}
		return calTrainings;
	}
	

}
